<template>
	<view>
		<view class="input_box">
			<view class="input_list">
				<text>姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名：</text>
				<input type="text" v-model="distributor.name" placeholder="请输入姓名" />
			</view>
			<view class="input_list">
				<text>手机号码：</text>
				<input type="number" v-model="distributor.phone" placeholder="请输入手机号" />
			</view>
			<view class="input_list">
				<text>身份证号：</text>
				<input type="number" v-model="distributor.id_card" placeholder="请输入身份证号" />
			</view>
			<view class="input_list">
				<text>邮&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;箱：</text>
				<input type="text" v-model="distributor.email" placeholder="邮箱" />
			</view>
			<view class="input_list">
				<text>详细地址：</text>
				<input type="text" v-model="distributor.detail_address" placeholder="小区、单元、房号" />
			</view>
		</view>
		<view style="width:750upx;height:10upx;background-color:#f4f4f4;"></view>
		<view class="notice">
			<view class="notice_title">申请须知</view>
			<view class="notice_content">
				甲乙双方本着平等、互利、互惠的原则，依照合同法及泰珠公司关于产品代理经销及营销管理制度的相应规定，经协商同意按下列条款签订本协
			</view>
		</view>
		<view class="submit">
			<view @click="confirm">提交申请</view>
		</view>
	</view>
</template>

<script>
	import request from '@/common/lib/request.js'
	export default {
		data() {
			return {
				distributor:{
					name:'',
					phone:'',
					id_card:'',
					email:'',
					detail_address:''
				}
			}
		},
		methods: {
			event(item){
				uni.navigateTo({
					url:"../orderlist/orderlist"
				})
			},
			
			confirm(){
				uni.request({
					url: request.common.baseUrl+'/api/distributor/distributorApply',
					data: {
						token:uni.getStorageSync('keyToken'),
						name:this.distributor.name,
						phone:this.distributor.phone,
						id_card:this.distributor.id_card,
						email:this.distributor.email,
						detail_address:this.distributor.detail_address
					},
					header: {
						'Content-Type':'application/json;charset=UTF-8',
						'Content-Type':'application/x-www-form-urlencoded'
					},
					success: (res) => {
						if(res.data.code==200){
							uni.showToast({
								title: res.data.msg,
								icon: 'none',
								duration: 2000,
							})
							setTimeout(function () {
							    uni.navigateBack({
							    	delta:1
							    })
							}, 2000);
						}else{
							uni.showToast({
								title: res.data.msg,
								icon: 'none',
								duration: 2000,
							})
						}
					}
				})
			}
		}
	}
</script>

<style>
page{
	background-color: #ffffff;
}
.input_box{
	width:700upx;
	padding:25upx;
}
.input_list{
	width:700upx;
	padding-top:25upx;
	padding-bottom:25upx;
	border-top:1upx solid #f6f6f6;
	text-indent:20upx;
}
.input_list:nth-child(1){
	border-top:unset;
}
.input_list text{
	color:#111111;
	font-size:24upx;
	height:60upx;
	line-height:60upx;
}
.input_list input{
	width:540upx;
	color:#999999;
	font-size:24upx;
	display:inline-block;
	overflow:unset;
	height:60upx;
	line-height:60upx;
}
.notice{
	margin:25upx;
}
.notice_title{
	margin-left:25upx;
	font-size:30upx;
	color:#333333;
}
.notice_content{
	margin:15upx 25upx 25upx 25upx;
	color:#666666;
}
.submit{
	margin-top:50upx;
	text-align:center;
}
.submit view{
	background-color:#ff6101;
	color:#FFFFFF;
	font-size:28upx;
	width:650upx;
	height:60upx;
	line-height:60upx;
	margin:auto;
	border-radius:30upx;
}
</style>
